from django.contrib.auth.models import Group, Permission
from rest_framework.generics import ListAPIView
from rest_framework.viewsets import ModelViewSet

from apps.meiduo_admin.serializers.group import GroupSerializer, PermissionSimpleSerializer
from apps.meiduo_admin.utils import PageNum


class GroupViewSet(ModelViewSet):

    queryset = Group.objects.all()
    serializer_class = GroupSerializer
    pagination_class = PageNum


class PermissionSimpleListView(ListAPIView):

    queryset = Permission.objects.all().order_by('id')
    serializer_class = PermissionSimpleSerializer